//
//  FSColorPicker.m
//  BlueToothProject
//
//  Created by foshou on 2017/3/2.
//  Copyright © 2017年 yxw. All rights reserved.
//

#import "FSColorPicker.h"

@implementation FSColorPicker

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor clearColor];
//        [self setNeedsDisplay];
    }
    return self;
}

- (void)drawRect:(CGRect)rect {
    // Drawing code
    [super drawRect:rect];
    
    //draw wings
    [[UIColor blackColor] set];
    
    //draw central bar over it
    CGFloat cbwidth = self.frame.size.height;
    for (int y = 0; y < self.frame.size.width; y++) {
        [[UIColor colorWithHue:(y/self.frame.size.width) saturation:1.0 brightness:1.0 alpha:1.0] set];
        CGRect temp = CGRectMake(y, 0, 1.0, cbwidth);
        UIRectFill(temp);
    }
}


@end
